package com.wang.interview.tests.exception;

/**
 * @author: wang
 * @date: 2021/8/8 15:02
 * @description: // 测试异常会在声明的地方产生还是运行错误的地方产生，结果是后者
 */
public class T1 {
    int[] a = {};
}

class T2{
    public static void main(String[] args) {
        T1 t1 = new T1();
        int[] a = null;
        try {
            a = t1.a;
        } catch (Exception e) {
            System.out.println(1);
        }

        try {
            int i = a[2];
        } catch (Exception e) {
            System.out.println(2);
        }


    }
}

